package com.nbufe.controller;

import com.nbufe.domain.ResponseResult;
import com.nbufe.domain.vo.news.News;
import com.nbufe.service.NewsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author luzhiheng
 * @Date 2023/12/24 17:42
 */
@RestController
@RequestMapping("/news")
public class NewsController {

    @Resource
    private NewsService newsService;

    @GetMapping("/queryNews")
    public ResponseResult queryNews(Integer page, Integer size) {
        List<News> newsList = newsService.queryNews(page, size);
        return ResponseResult.okResult(newsList);
    }

    @GetMapping("/queryPolicy")
    public ResponseResult queryPolicy(Integer page, Integer size) {
        List<News> policyList = newsService.queryPolicy(page, size);
        return ResponseResult.okResult(policyList);
    }

    @GetMapping("/queryOriginGoods")
    public ResponseResult queryOriginGoods(Integer page, Integer size) {
        List<News> originGoodList = newsService.queryOriginGoods(page, size);
        return ResponseResult.okResult(originGoodList);
    }
}
